#include<stdio.h>
#include<stdlib.h>
struct node//自定义单链表节点 
{
        char call;
        struct node *next;
};
//创造节点
struct node * new_nodes()
{
        struct node *part;
        part = (struct node*)malloc(sizeof(struct node));
        part->next = NULL;
        return part;
}
//在节点后插入空节点 
void add_node(struct node * basenode)
{
	struct node * last = basenode->next;
	basenode->next=new_nodes(char enter);
	basenode->next->next=last;
	return basenode;
}
//在链表第n个节点后插入空节点
void add_n_nodes(struct node * basenode,int n)
{
	int i=0;
	struct node * last = basenode;
	while (last->next != NULL&&i<n) {
        last = last->next;
    }
    add_node(last);
    return basenode;
}
//在链表末插入空节点
void add_n_nodes(struct node * basenode)
{
	struct node * last = basenode;
	while (last->next != NULL) {
        last = last->next;
  }
  add_node(last);
}
//在链表末插入空节点并赋值
void add_n_nodes(struct node * basenode)
{
	struct node * last = basenode;
	while (last->next != NULL) {
        last = last->next;
  }
  add_node(last);
  last->next->call=call;
}
//在链表第n个节点后插入空节点并赋值
void add(struct node * basenode,int n，char call)
{
	int i=0;
	struct node * last = basenode;
	while (last->next != NULL&&i<n) {
        last = last->next;
    }
  add_n_node(last);
  last->next->call=call;
}
//在节点后删除一个节点 
struct node * delete_node(struct node * basenode)
{
	struct node * last=basenode->next;
	basenode->next=basenode->next->next; 
	free(last);
	return basenode;
}
//在链表第n个节点后删除一个节点
struct node * delete_n_nodes(struct node * basenode,int n)
{
	int i=0;
	struct node * last = basenode;
	while (last->next != NULL&&i<n) {
        last = last->next;
    }
    if(i==n)
    delete_node(last);
    return basenode;
}
//获取链表第n个节点 
struct node * get(struct node * basenode,int n)
{
	int i=0;
  struct node * last = basenode;
	while (last->next != NULL&&i<n) {
        last = last->next;
    }
    if(i==n)
    return last;
    return NULL; 
}
//遍历链表
struct node * list(struct node * basenode)
{
  int i=0;
  struct node * last = basenode;
	while (last->next != NULL) {
    printf("%c",last->call);
    last = last->next;
  }
}
//在链表第n个节点写入值(修改值)
struct node * update(struct node * basenode,int n,char call)
{
	struct node * last = get_nodes(basenode,int n);
	last->call=call;
}